************************************************
***Title: robustness_fixed_effects.do
***Creators: Joelle Abramowitz, Shooshan Danagoulian, and Owen Fleming*
***Notes: This file produces the estimates of the effect of pollen exposure on suicides using several alternate sets of fixed effects. 

*For questions, contact
*Owen Fleming
*hg3490@wayne.edu
************************************************


**********SETUP
use data/for_analysis, clear


**********PRODUCE ESTIMATES
*Treatment: location-season quartiles
eststo robf_s1: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather, absorb(county year_month month_day) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "County, Year x Month, Month x Day"

*Treatment: location-season quartiles
eststo robf_s2: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather, absorb(county day month year) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "County, Day, Month, Year"

*Treatment: location-season quartiles
eststo robf_s3: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather, absorb(month_day county_year_month) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "Month x Day, County x Year x Month"

*Treatment: location-season quartiles
eststo robf_s4: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather, absorb(month_day county_month_dow county_year_month) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "Month x Day, County x Month x DOW, County x Year x Month"

*Treatment: location-season quartiles
eststo robf_s5: ppmlhdfe count pollen_q2_ls pollen_q3_ls pollen_q4_ls $weather, absorb(county date) cluster(county) tolerance(1e-06)
estadd ysumm
estadd scalar counties = e(N_clust)
estadd local Controls "Weather" 
estadd local FE "County, Date"


**********EXPORT
estout using results/robustness_fixed_effects.xls, cells(b(star label(Coef.) fmt(4)) se(par(`"="("'`")""') label(Std. Err.) fmt(4))) stats(ymean N counties Controls FE) starlevels(* 0.1 ** 0.05 *** 0.01) keep(pollen_q2_ls pollen_q3_ls pollen_q4_ls) legend label replace 
eststo clear


